/*! ----------------------------+---------------+-------------------------------
	patchcg.m
	patchcg
	
	@discussion
		tool to patch coregraphics
		note that we must be suid root in order to mess with the windowserver,
		as well as to muck w/ coregraphics on disk.
		
		this doesn't work exactly as advertised, but it should be enough to get
		you going. Note that Apple binaries are signed on Intel and on both
		platforms in 10.5, so the apply-to-disk method will likely go away at
		that point, forcing an in-memory solution
*/

#import <Foundation/Foundation.h>

#import "patchcgfile.h"
#import "patchcgmemory.h"


/*! ----------------------------+---------------+-------------------------------
*/
int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

	// try setting euid to 0, if success then we are running as root
	int err = seteuid(0);
    if (err != 0) {
        NSLog(@"patchcg must be run as root.\n");
		goto exit;
    } else {
		NSLog(@"running as root\n");
	}
	printf("\n");
	
	patchCGFile();
	//patchCGmemory();
	
exit:
    [pool release];
    return 0;
}


